Developer Documentation
PATHJava Developer Documentation > Mac OS Runtime for Java > JManager > Programming With JManager


Session Callbacks Structure

When you create an instantiation of the Java runtime environment using the JMOpenSession function, you must pass a data structure that supplies callback information for that instantiation. The session callbacks data structure is defined by the JMSessionCallbacks data type.

struct JMSessionCallbacks {
    UInt32                  fVersion;           /* set to kJMVersion */
    JMConsoleProcPtr        fStandardOutput;    /* standard output */
    JMConsoleProcPtr        fStandardError;     /* standard error */
    JMConsoleReadProcPtr    fStandardIn;        /* standard input */
    JMExitProcPtr           fExitProc;          /* handle System.exit */
    JMAuthenticateURLProcPtrfAuthenticateProc;  /* for authentication */
    JMLowMemoryProcPtr      fLowMemProc;        /* low memory warning */
};

Field descriptions

fVersion
The version of JManager. You should set this field to kJMVersion .
fStandardOutput
A pointer to a function that handles text sent to the standard output. JManager sends all console output to this function. This callback has the following type definition:
                    typedef void (*JMConsoleProcPtr) (
                        JMSessionRef session, const char* message,
                        UInt32 messageLen);
For more information, see the description of the application-defined function MyStandardOutput.
Note that all text sent to this function will be encoded using the text encoding you specified when calling JMOpenSession .
fStandardError
A pointer to a function that handles standard error output. JManager sends any error messages to this function. This callback has the following type definition:
                    typedef void (*JMConsoleProcPtr) (
                        JMSessionRef session, const char* message,
                        UInt32 messageLen);
For more information, see the description of the application-defined function MyStandardError.
Note that all text sent to this function will be encoded using the text encoding you specified when calling JMOpenSession .
fStandardIn
A pointer to a function that handles console input. JManager accepts input from this routine. This value can be a null pointer, which indicates default behavior (no console input). This callback has the following type definition:
                    typedef SInt32 (*JMConsoleReadProcPtr) (
                        JMSessionRef session, char* buffer,
                        SInt32 maxBufferLength);
For more information, see the description of the application-defined function MyStandardIn.
fExitProc
A pointer to a function that handles calls to java.lang.System.exit (that is, requests to quit). This callback has the following type definition:
                    typedef Boolean (*JMExitProcPtr) (
                        JMSessionRef session, int value);
For more information, see the description of the application-defined function MyExit.
fAuthenticateProc
A pointer to a function that handles user authentication requests (such as a request for a password) for a URL. This callback has the following type definition:
                    typedef Boolean (*JMAuthenticateURLProcPtr) (
                        JMSessionRef session, const char* url,
                        const char* realm, char userName[255],
                        char password[255]);
For more information, see the description of the application-defined function MyAuthenticate.
fLowMemProc
A pointer to a function that handles low-memory conditions. This callback has the following type definition:
                    typedef Boolean (*JMLowMemoryProcPtr) (
                        JMSessionRef session);
For more information, see the description of the application-defined function MyLowMem.

© 1998 Apple Computer, Inc. — (Last Updated 3 Dec 98)